package cn.vawn.exam.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.vawn.exam.entity.QuestionSerial;
import cn.vawn.exam.mapper.QuestionSerialMapper;
import cn.vawn.exam.service.IQuestionSerialService;

@Service("questionSerialService")
public class QuestionSerialServiceImpl implements IQuestionSerialService {

	@Resource
	private QuestionSerialMapper questionsSerialMapper;
	
	@Override
	public void updateOrInsertQuestionSerial(List<QuestionSerial> questionSerials) {
		//��������
		for(QuestionSerial questionSerial : questionSerials) {
			//
			QuestionSerial qs = 
					questionsSerialMapper.selectQuestionSerialById(questionSerial);
			//�����ݲ���
			if(qs == null) {
				questionsSerialMapper.insertQuestionSerial(questionSerial);
			} else {
				//
				questionsSerialMapper.updateQuestionSerialById(questionSerial);
			}
		}
	}

	@Override
	public QuestionSerial getQuestionSerial(QuestionSerial questionSerial) {
		return questionsSerialMapper.selectQuestionSerialById(questionSerial);
	}

}
